package com.ufo.unzip;

import com.ufo.unzip.utils.UnZipUtils;

import java.util.List;
import java.util.stream.Collectors;

import static com.ufo.unzip.utils.UnZipUtils.getFiles;

/**
 * @Author ufo
 * @Description TODO
 * @Date 2021/1/18 9:56
 * @Version 1.0
 */
public class main {
    public static void main(String[] args)  {
        boolean suc;
        UnZipUtils z = new UnZipUtils();
        String path="F:\\新建文件夹";
        String[] pas={"st1069","10691069","1234","1234"};
        List<String> files = getFiles(path);
        List<String> sources = files.stream().filter(item -> item.endsWith(".zip") || item.endsWith(".rar")).collect(Collectors.toList());
        for (String source : sources) {
            String dest = source.replace(".zip","").replace(".rar","");
            for (String pa : pas) {
                try {
                    z.unZip(source,dest,pa);
                    suc=true;
                    break;
                } catch (Exception e) {
                    System.out.println(e);
                    continue;
                }
            }
        }
    }
}
